// ==UserScript==
// based on        http://la.ma.la/blog/diary_200601201204.htm
// @name           sinatra_auto_reload_<%= @host.gsub(/[\.\/:]/,'_') %>.user.js
// @namespace      http://shokai.org/
// @description    reload Firefox/Chrome when <%= @host %> was modified
// @include        http://<%=@host%>/*
// @version        0.0.2
// @author         shokai (Sho Hashimoto)
// ==/UserScript==

setInterval(function(){
	var req;
	var self = arguments.callee;
	var req = new XMLHttpRequest;
	req.open("GET", "http://<%=@host%>/sinatra_auto_reload", true);
	req.onload = function(){
	    (self.old && req.responseText != self.old) && location.reload(true);
	    self.old = req.responseText;
	};
	req.send(null);
    },<%=@interval%>);
